
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[ReportBaseObjectIsExist]
    @BookmarkId INT ,
    @IsGroup BIT ,
    @Name VARBINARY(MAX)
AS 
    BEGIN
        SELECT  COUNT(*)
        FROM    ReportBaseObject
        WHERE   Name = @Name
                AND ( ( @IsGroup = 0
                        AND WordBookmarkId = @BookmarkId
                      )
                      OR ( @IsGroup = 1
                           AND BookmarkGroupId = @BookmarkId
                         )
                    )
                AND Deleted = 0
    END
GO
